Testing ioos_glider.writer_0_0()


In [3]:
import ioos_glider
import numpy as np
import netCDF4

Create some dummy data


In [5]:
lon = lat = depth = dens = press = cond = temp = salt = segment_id = profile_id = np.ones((100,))
traj = np.arange(2)
lon_uv = lat_uv = u = v = np.arange(50)
time_uv = netCDF4.num2date(np.arange(0,500, 10), units='seconds since 1970-01-01')
time = netCDF4.num2date(np.arange(0,1000, 10), units='seconds since 1970-01-01')

Write basic file, with no qc


In [6]:
ioos_glider.writer_0_0("test_out.nc", time, time_uv, traj, segment_id, profile_id, depth, lat, lon, press, cond, dens, salt, temp, u, v, lat_uv, lon_uv)

Success!


In [7]:
%%bash
ls


ioos_glider.py
ioos_glider.py~
ioos_glider.pyc
libpeerconnection.log
LICENSE
README.md
Testing ioos_glider.py.ipynb
test_out.nc

In [8]:
#with netCDF4.Dataset('test_out.nc') as nc:
#    print nc

Write file with qc info


In [9]:
ioos_glider.writer_0_0("test_out.nc", time, time_uv, traj, segment_id, profile_id, depth, lat, lon, press, cond, dens, salt, temp, u, v, lat_uv, lon_uv,
                       time_qcdata=lon, u_qcdata=u, v_qcdata=v, depth_qcdata=depth, lat_qcdata=lat, lon_qcdata=lon, pressure_qcdata=press, 
                       conductivity_qcdata=cond, density_qcdata=dens, salinity_qcdata=salt, temperature_qcdata=temp)

Write file, and override the global attribute title


In [10]:
ioos_glider.writer_0_0("test_out.nc", time, time_uv, traj, segment_id, profile_id, depth, lat, lon, press, cond, dens, salt, temp, u, v, lat_uv, lon_uv,
                       time_qcdata=lon, u_qcdata=u, v_qcdata=v, depth_qcdata=depth, lat_qcdata=lat, lon_qcdata=lon, pressure_qcdata=press, 
                       conductivity_qcdata=cond, density_qcdata=dens, salinity_qcdata=salt, temperature_qcdata=temp, title="Alex's new awesome title")

Success!


In [11]:
with netCDF4.Dataset('test_out.nc') as nc:
    print nc.title


Alex's new awesome title

In [ ]: